//package cn.nfwx.tv.fragment;
//
//import android.support.v4.app.Fragment;
//import android.support.v4.app.FragmentManager;
//import android.support.v4.app.FragmentTransaction;
//import android.view.View;
//
//import org.greenrobot.eventbus.EventBus;
//import org.greenrobot.eventbus.Subscribe;
//import org.greenrobot.eventbus.ThreadMode;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import cn.nfwx.tv.R;
//import cn.nfwx.tv.base.BaseFragment;
//import cn.nfwx.tv.events.ToSmsLoginEvents;
//
///**
// * Created by dell on 2018/1/8.
// */
//
//public class LoginMainFragment extends BaseFragment {
//    private FragmentManager fragmentManager;
//    private FragmentTransaction fragmentTransaction;
//    private LoginAndRegisterFragment loginAndRegisterFragment;
//    private SmsLoginFragment smsLoginFragment;
//    private List<Fragment> fragmentList;
//    private Fragment tempFragment;
//    private Fragment nowFragment = new LoginAndRegisterFragment();;
//
//    @Override
//    public View initView() {
//        View view =View.inflate(getActivity(), R.layout.fragment_main_login,null);
//        EventBus.getDefault().register(this);
//        return view;
//    }
//
//    @Override
//    public void onStart() {
//        super.onStart();
//        loginAndRegisterFragment=new LoginAndRegisterFragment();
//        smsLoginFragment=new SmsLoginFragment();
//        fragmentList=new ArrayList<Fragment>();
//        fragmentList.add(smsLoginFragment);
//        fragmentList.add(loginAndRegisterFragment);
//        switchFragment(tempFragment,fragmentList.get(0));
//    }
//
//    public void switchFragment(Fragment fromFragment, Fragment nextFragment) {
//        if (tempFragment != nextFragment) {
//
//            tempFragment = nextFragment;
//
//            if (nextFragment != null) {
//                FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();
//                //判断nextFragment是否添加
//                if (!nextFragment.isAdded()) {
//                    //隐藏当前Fragment
//                    if (fromFragment != null) {
//                        transaction.hide(fromFragment);
//                    }
//                    transaction.replace(R.id.main_container, nextFragment, "tagFragment").commit();
//                } else {
//                    //隐藏当前Fragment
//                    if (fromFragment != null) {
//                        transaction.hide(fromFragment);
//                    }
//                    transaction.show(nextFragment).commit();
//                }
//            }
//        }
//    }
//
//
//
//
//    @Override
//    public void onDestroy() {
//        super.onDestroy();
//        EventBus.getDefault().unregister(this);
//    }
//}
